# @Author: Eric Ito
# @Date: 1/29/2009
# @Name: Project Euler Problem 36


"""
The decimal number, 585 = 1001001001 (binary),
is palindromic in both bases.

Find the sum of all numbers, less than one million,
which are palindromic in base 10 and base 2.
"""

from converter import dec2bin
from util import isPalindrome

def main():
    total = 0
    for i in range(1000001):
        if isPalindrome(str(i)) and isPalindrome(str(dec2bin(i))):
            total += i
    print total



if __name__ == "__main__":
    main()